package month4.day27;

import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class S {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
        Date date = new Date();

            try {
                BufferedWriter bf=new BufferedWriter(new FileWriter("E:\\Java8\\新建文件夹\\java78.txt"));
                while (true){
                    System.out.println("输入字符");
                    String str = in.next();
                    if (str.equals("quit"))
                        break;
                    bf.write(sdf.format(date.getTime()));
                    bf.write("  ");
                    bf.write(str);
                    bf.write("\n");
                }
                bf.close();


                BufferedReader bfd=new BufferedReader(new FileReader("E:\\Java8\\新建文件夹\\java78.txt"));
                char[]chars=new char[100];
                int str;
                while ((str=bfd.read(chars))!=-1){
                    System.out.println(new String(chars,0,str));
                }
                bfd.close();
            } catch (Exception e) {
                e.printStackTrace();
            }

    }
}
